//
//  YWMenuViewController.m
//  百布业务
//
//  Created by 陈炳桦 on 15/10/26.
//  Copyright © 2015年 陈炳桦. All rights reserved.
//

#import "YWMenuViewController.h"

@interface YWMenuViewController ()

@property (nonatomic,strong) NSArray *array;

@end

@implementation YWMenuViewController

- (NSArray *)array{
    if (_array == nil) {
        _array = @[@"商户录入记录",@"应用设置",@"退出登录"];
    }
    
    return _array;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.tableView.showsVerticalScrollIndicator = NO;
}


#pragma mark - Table view data source
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return self.array.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *ID = @"ID";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.text = self.array[indexPath.row];
    
    return cell;
}

#pragma mark - TableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    // 发送通知
    [[NSNotificationCenter defaultCenter] postNotificationName:@"YWMenuViewControllerSelectItem" object:self.array[indexPath.row] userInfo:nil];
}

@end
